# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=wnmap
pkgver=0.1
pkgrel=8
groups=('blackarch' 'blackarch-automation' 'blackarch-scanner')
pkgdesc='A shell script written with the purpose to automate and chain scans via nmap.'
arch=('any')
url='http://nullsecurity.net/tools/automation.html'
license=('GPL3')
depends=('nmap' 'vim')
source=("https://github.com/nullsecuritynet/tools/raw/main/automation/$pkgname/release/$pkgname-$pkgver.tar.gz")
sha512sums=('c8469d8dc28f69271b50bef186adf9c6b371792f3122e43bd12b35b76c1db66e3c6b2ae25281a2e258af13295defce254e24ada39448b2c8539bb0206b069335')

prepare() {
  cd "$pkgname-$pkgver"

  sed -i 's|WNMAP_PATH="/path_to/wnmap"|WNMAP_PATH="/usr/share/wnmap"|' \
    src/core/wnmap
}

package() {
  cd "$pkgname-$pkgver"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 docs/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm docs/LICENSE

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" docs/*

  cp -LR --no-preserve=ownership src/ "$pkgdir/usr/share/$pkgname/"

  chmod +x "$pkgdir/usr/share/$pkgname/src/core/$pkgname"

  ln -s "/usr/share/wnmap/src/core/$pkgname" "$pkgdir/usr/share/$pkgname"
  ln -s "/usr/share/wnmap/src/core/$pkgname" "$pkgdir/usr/bin/$pkgname"
}

